|
|
|
|
|
|
|
The code in Listing 14.20 first sets the dialog caption and message box. Then, based on the properties of the udtErrDialog type, the buttons are arranged on the form. The only other code that needs to be added to this form is the code that goes behind the command button array. Place the code from Listing 14.21 in the cmdBtn_Click event of the form. |
|
|
|
|
|
|
|
|
Listing 14.21. Coding the cmdBtn_Click event. |
|
|
|
|
|
|
|
|
Private Sub cmdBtn_Click(Index As Integer)
'
' return user selection
'
Dim lngReturn As Long
'
Select Case Index
Case 0
udtErrDialog.Return = errExit
lngReturn = WinHelp(Me.hwnd, udtErrDialog.HelpFile, HELP_QUIT, &H0)
Unload Me
Case 1
udtErrDialog.Return = errresume
lngReturn = WinHelp(Me.hwnd, udtErrDialog.HelpFile, HELP_QUIT, &H0)
Unload Me
Case 2
udtErrDialog.Return = errNext
lngReturn = WinHelp(Me.hwnd, udtErrDialog.HelpFile, HELP_QUIT, &H0)
Unload Me
Case 3
lngReturn = WinHelp(Me.hwnd, udtErrDialog.HelpFile, HELP_CONTEXT,
udtErrDialog.HelpID)
End Select
'
End Sub |
|
|
|
|
|
|
|
|
The code in Listing 14.21 allows the user to select the command button appropriate for the moment. If the user presses the Help button, the properties from the udtErrDialog type are used to fill in the parameters of the WinHelp API call. |
|
|
|
|
|
|
|
|
That's all the code you need to create your errHandler ActiveX DLL. Save the project and then compile it (File | Make prjErrHandler.dll). If it compiles without error, you're all set for a quick test! |
|
|
|
|
|
|
|
|
Testing the ErrHandler Object Library |
|
|
|
|
|
|
|
|
Start a new Visual Basic 5 Standard EXE project. Set the form name to frmTest and the project name to prjTest. Add a data control and a command button to the form. Refer to Figure 14.17 while laying out the form. |
|
|
|
|
|